
function addZero(t) {
    return t < 10? "0"+t : t;
}

module.exports = {
    timeFormat : function(timestamp) {
        var tDate = new Date();
        tDate.setTime(timestamp * 1000); //timestamp为秒数，setTime为毫秒
        
        return tDate.getFullYear() +"-"+ 
        addZero(tDate.getMonth() + 1) +"-"+
        addZero(tDate.getDay()) +" "+
        addZero(tDate.getHours()) +":"+
        addZero(tDate.getMinutes()) +":"+
        addZero(tDate.getSeconds());
    }
}